
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Windows.Forms;

using ZoneFiveSoftware.Common.Visuals.Fitness;

namespace BENBUN.ExportCRS
{
    
    class BenbunPlugin
    {
        public static BenbunPlugin Instance
        {
            get
            {
                if (instance == null) instance = new BenbunPlugin();
                return instance;
            }
        }

        public IApplication Application
        {
            get { return application; }
        }


        public string PluginVersion
        {
            get { return GetType().Assembly.GetName().Version.ToString(3); }
        }


        private void WriteOptions(XmlDocument xmlDoc, XmlElement pluginNode)
        {
            CredentialsCache.Instance.WriteOptions(xmlDoc, pluginNode);
        }
        private void ReadOptions(XmlDocument xmlDoc, XmlNamespaceManager nsmgr, XmlElement pluginNode)
        {
            CredentialsCache.Instance.ReadOptions(xmlDoc, nsmgr, pluginNode);
        }

        public enum NameLocation
        {
           location,
           name,
        }    
        // Options page
        public double turnAngle
        {
            get { return _turnAngle; }
            set { _turnAngle = value; }
        }

        public double maxLength
        {
            get { return _maxLength; }
            set { _maxLength = value; }
        }

        public double valleySizeAsc
        {
            get { return _valleySizeAsc; }
            set { _valleySizeAsc = value; }
        }

        public double valleySizeDec
        {
            get { return _valleySizeDec; }
            set { _valleySizeDec = value; }
        }

        public double summitSizeAsc
        {
            get { return _summitSizeAsc; }
            set { _summitSizeAsc = value; }
        }

        public double summitSizeDec
        {
            get { return _summitSizeDec; }
            set { _summitSizeDec = value; }
        }

        public Boolean doTurns
        {
            get { return _doTurns; }
            set { _doTurns = value; }
        }

        public Boolean doValleys
        {
            get { return _doValleys; }
            set { _doValleys = value; }
        }

        public Boolean doSummits
        {
            get { return _doSummits; }
            set { _doSummits = value; }
        }

        public Boolean doMaxLength
        {
            get { return _doMaxLength; }
            set { _doMaxLength = value; }
        }

        public String nameSourceLocation
        {
            get { return _nameSourceLocation; }
            set { _nameSourceLocation = value; }
        }

        public String distanceUnits
        {
            get { return _distanceUnits; }
            set { _distanceUnits = value; }
        }

        public Boolean originalTime
        {
            get { return _originalTime; }
            set { _originalTime = value; }
        }
        public Double newSpeedValue
        {
            get { return _newSpeedValue; }
            set { _newSpeedValue = value; }
        }
        public String newSpeedUnits
        {
            get { return _newSpeedUnits; }
            set { _newSpeedUnits = value; }
        }
        class Plugin : IPlugin
        {

            #region IPlugin Members

            public IApplication Application
            {
                set { application = value; }
            }

            public Guid Id
            {
                get { return new Guid("{c2e2202c-b922-11db-96ee-005056c00007}"); }
            }

            public string Name
            {
                get { return "BENBUN : Export CRS Plugin"; }
            }

            public string Version
            {
                get { return GetType().Assembly.GetName().Version.ToString(3); }
            }

            public void ReadOptions(XmlDocument xmlDoc, XmlNamespaceManager nsmgr, XmlElement pluginNode)
            {
                BenbunPlugin.Instance.ReadOptions(xmlDoc, nsmgr, pluginNode);
            }


            public void WriteOptions(XmlDocument xmlDoc, XmlElement pluginNode)
            {
                BenbunPlugin.Instance.WriteOptions(xmlDoc, pluginNode);
            }

            #endregion

            public static IApplication GetApplication()
            {
                return application;
            }

            #region Private members
            private static IApplication application;
            #endregion
        }

        private static BenbunPlugin instance = null;
        private IApplication application = null;
        private Double _summitSizeAsc = 20;
        private Double _valleySizeAsc = 20;
        private Double _summitSizeDec = 20;
        private Double _valleySizeDec = 20;

        private Double _turnAngle = 45;
        private Double _maxLength = 20;

        private Boolean _doSummits = true;
        private Boolean _doValleys = true;
        private Boolean _doTurns = true;
        private Boolean _doMaxLength = false;
        private String _nameSourceLocation = "location";
        private String _distanceUnits = "meters";
        private Boolean _originalTime = false;
        private Double _newSpeedValue = 8;
        private String _newSpeedUnits = "MintuesPerMile";

        public string exportFileName;
        public decimal export_speed;
        public int export_speedUnits;


    }
}
